package com.cym.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cym.bean.OrderBy.Direction;
import com.cym.bean.Sort;
import com.cym.model.Box;
import com.cym.service.BoxService;
import com.cym.utils.BaseController;

@Controller
@RequestMapping("/box")
public class BoxController extends BaseController {

	@Autowired
	BoxService boxService;

	@RequestMapping("")
	public ModelAndView main(ModelAndView modelAndView) {

		modelAndView.addObject("boxList", jpaHelper.findAll(new Sort(Box::getCode, Direction.ASC), Box.class));
		modelAndView.setViewName("/box/index");
		return modelAndView;
	}

}
